<!DOCTYPE HTML>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">
  <head>
    <base href="http://127.0.0.1/ebpm/">
    
    <title>My JSP 'index.jsp' starting page</title>
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	
	<style type="text/css">
		*{
			margin:0;padding:0;
			font-family: Calibri;font-size:18px;
		}
		table {
			background:#c3c3c3;
		}
		td{
			background:#efefef;
		}
		tr{
			height:30px;
		}
	</style>
	
	<script type="text/javascript" src="js/jquery.js"></script>
  </head>
  
  <body>
  
  	 <div style="position: fixed;bottom: 0;background: #c4c4c4 ;width:100%;height: 80px;text-align: center;padding-top:20px;">
    	<div>
    			<form action="wf/login" th:if="${session.LOGIN_USER} == null" >
    				<select name="username" style="width:160px;" >
    					<optgroup label="员工级别">
							<option th:each="user:${users}" th:if="${user.role} eq 'employ'" th:value="${user.name}" th:text="${user.name}">/option>
    					</optgroup>
						<optgroup label="经理级别">
							<option th:each="user:${users}" th:if="${user.role} eq 'manager'" th:value="${user.name}" th:text="${user.name}">/option>
						</optgroup>
						<optgroup label="考勤专员">
							<option th:each="user:${users}" th:if="${user.role} eq 'kaoqin'" th:value="${user.name}" th:text="${user.name}">/option>
						</optgroup>
						<optgroup label="老板级别">
							<option th:each="user:${users}" th:if="${user.role} eq 'boss'" th:value="${user.name}" th:text="${user.name}">/option>
						</optgroup>
    				</select>
    				<input type="submit" value="登录" style="width:80px;margin-left:20px;" >
		    		<input type="button" value="流程部署" onclick="window.location.href='wf/deploy'" style="width:100px;margin-left:20px;" >
    			</form>

    			<span th:if="${session.LOGIN_USER} != null" th:text="${session.LOGIN_USER}" ></span>
    			<input th:if="${session.LOGIN_USER} != null" type="button" value="退出登录" onclick="window.location.href='wf/loginOut'" style="width:100px;margin-left:20px;" >
	    		<input th:if="${session.LOGIN_USER} != null" type="button" value="流程部署" onclick="window.location.href='wf/deploy'" style="width:100px;margin-left:20px;" >
    	</div>
    	
  	 </div>
  
    <div th:if="${session.LOGIN_USER} != null" >
    
		<div style="text-align: center;margin-left:10%;margin-top:10px;width:80%;">
			
			<table style="width:100%;text-align: center;" >
				<tr>
	                <td colspan="4" align="center"><h1>流程部署信息</h1></td>
	            </tr>
				<tr>
					<td>流程标识</td>
					<td>流程描述</td>
					<td>创建时间</td>
					<td>操作</td>
				</tr>
					<tr th:each="deploy:${deploys}">
						<td>[[${deploy.key }]]</td>
						<td>[[${deploy.desc }]]</td>
						<td th:text="${#dates.format(deploy.createTime, 'yyyy-MM-dd HH:mm:ss')}" ></td>
						<td><a th:href="@{'wf/start?key=' + ${deploy.key }}">启动</a></td>
					</tr>
			</table>
		</div>


		<div style="text-align: center;margin-left:10%;margin-top:20px;width:80%;">
			<table style="width:100%;text-align: center;" >
				<tr>
					<td colspan="4" align="center"><h1>待办任务</h1></td>
				</tr>
				<tr>
					<td>任务信息</td>
					<td>执行人</td>
					<td>签收时间</td>
					<td>操作</td>
				</tr>
					<tr th:each="task:${tasks}">
						<td>[[${task.desc }]]</td>
						<td>[[${task.assignee }]]</td>
						<td th:text="${#dates.format(task.assigneeTime, 'yyyy-MM-dd HH:mm:ss')}" ></td>
						<td><a th:href="@{'wf/hisTask?taskId=' + ${task.id } + '&rootExecutionId=' + ${task.rootExecutionId} + '&missionId=' + ${task.missionId}}">详情</a></td>
					</tr>
			</table>
		</div>

		<div style="text-align: center;margin-left:10%;margin-top:20px;width:80%;">
			<table style="width:100%;text-align: center;" >
				<tr>
					<td colspan="4" align="center"><h1>待签收列表</h1></td>
				</tr>
				<tr>
					<td>任务标识</td>
					<td>任务信息</td>
					<td>创建时间</td>
					<td>操作</td>
				</tr>
					<tr th:each="task:${claimTasks}">
						<td>[[${task.id }]]</td>
						<td>[[${task.desc }]]</td>
						<td th:text="${#dates.format(task.createTime, 'yyyy-MM-dd HH:mm:ss')}"></td>
						<td><a th:href="@{'wf/claim?taskId=' + ${task.id }}">签收</a></td>
					</tr>
			</table>
		</div>

		<div style="text-align: center;margin-left:10%;margin-top:20px;width:80%;">
			<table style="width:100%;text-align: center;" >
				<tr>
					<td colspan="6" align="center"><h1>流程管理</h1></td>
				</tr>
				<tr>
					<td>流程标志</td>
					<td>流程信息</td>
					<td>创建时间</td>
					<td>完成时间</td>
					<td>状态</td>
					<td>操作</td>
				</tr>
					<tr th:each="e:${executions}">
						<td>[[${e.name }]]</td>
						<td>[[${e.desc }]]</td>
						<td th:text="${#dates.format(e.createTime, 'yyyy-MM-dd HH:mm:ss')}" ></td>
						<td th:text="${#dates.format(e.dueTime, 'yyyy-MM-dd HH:mm:ss')}" ></td>
						<td>
							<span th:if="${e.runStatus == true}" style="font-size:16px;color:red;font-weight: bold;">执行中</span>
							<span th:if="${e.runStatus == false}" style="font-size:16px;color:green;font-weight: bold;">完成</span>
						</td>
						<td><a th:href="@{'wf/hisTask?rootExecutionId=' + ${e.rootId }}">查看</a></td>
					</tr>
			</table>
		</div>
		


    </div>
    
  </body>
</html>
